<script setup>
import {onMounted, ref} from "vue";
import {useUserStore} from "@/stores/user"
import {UserInfoApi} from "@/apis/user"

const user = ref({
  profile: {},
  group: {}
});
const store = useUserStore();
onMounted(() => {
  const id = store.user.id;
  UserInfoApi(id)
      .then(res => {
        const {code, data} = res.data;
        if (code === 1) {
          user.value = data;
        }
      })
})

</script>
<template>
  <main>
    <t-cell-group title="当前绑定">
      <t-cell title="姓名" :note="user.profile.name"></t-cell>
      <t-cell title="绑定手机" :note="user.profile.phone"></t-cell>
      <t-cell title="身份证号" :note="user.card"></t-cell>
      <t-cell title="学号" :note="user.student_id"></t-cell>
      <t-cell title="所在部门" :note="user.profile.department"></t-cell>
      <t-cell title="用户组" :note="user.group.name"></t-cell>
    </t-cell-group>
  </main>
</template>